<template>
    <div class="management-container">
      <div class="sidebar">
        <div class="logo">
          <h3>管理系统</h3>
        </div>
        
        <div class="menu">
          <ul>
            <li @click="navigateTo('dashboard')">仪表盘</li>
            <li @click="navigateTo('users')">用户管理</li>
            <li @click="navigateTo('articles')">文章管理</li>
            <li @click="navigateTo('comments')">评论管理</li>
            <li @click="navigateTo('settings')">系统设置</li>
          </ul>
        </div>
      </div>
      
      <div class="main-content">
        <div class="content-header">
          <h2>{{ currentModule }}</h2>
          <div class="user-info">
            <span>{{ username }}</span>
            <img src="https://picsum.photos/32/32" alt="用户头像">
          </div>
        </div>
        
        <div class="content-body">
          <div class="dashboard" v-if="currentModule === '仪表盘'">
            <div class="stats">
              <div class="stat-card">
                <div class="title">用户总数</div>
                <div class="value">1,284</div>
                <div class="change">+12.5% 本周</div>
              </div>
              
              <div class="stat-card">
                <div class="title">文章总数</div>
                <div class="value">542</div>
                <div class="change">+8.3% 本周</div>
              </div>
              
              <div class="stat-card">
                <div class="title">评论总数</div>
                <div class="value">3,871</div>
                <div class="change">+4.7% 本周</div>
              </div>
              
              <div class="stat-card">
                <div class="title">活跃用户</div>
                <div class="value">256</div>
                <div class="change">+18.2% 本周</div>
              </div>
            </div>
            
            <div class="charts">
              <div class="chart">
                <h3>用户增长趋势</h3>
                <div class="chart-content">图表区域</div>
              </div>
              
              <div class="chart">
                <h3>文章发布统计</h3>
                <div class="chart-content">图表区域</div>
              </div>
            </div>
          </div>
          
          <div class="module-content" v-else>
            <h3>{{ currentModule }} 内容区域</h3>
            <p>这里是 {{ currentModule }} 的具体内容</p>
          </div>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
        username: localStorage.getItem('username') || '用户',
        currentModule: '仪表盘'
      }
    },
    methods: {
      navigateTo(module) {
        const moduleMap = {
          'dashboard': '仪表盘',
          'users': '用户管理',
          'articles': '文章管理',
          'comments': '评论管理',
          'settings': '系统设置'
        }
        
        this.currentModule = moduleMap[module] || '仪表盘'
      }
    }
  }
  </script>
  
  <style scoped>
  .management-container {
    display: flex;
    height: 100vh;
  }
  
  .sidebar {
    width: 220px;
    background-color: #001529;
    color: white;
    height: 100%;
  }
  
  .logo {
    padding: 20px;
    border-bottom: 1px solid #1890ff;
  }
  
  .menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  .menu li {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
  }
  
  .menu li:hover {
    background-color: #1890ff;
  }
  
  .main-content {
    flex: 1;
    overflow: auto;
  }
  
  .content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
  }
  
  .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  
  .user-info img {
    border-radius: 50%;
  }
  
  .content-body {
    padding: 20px;
  }
  
  .stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
  }
  
  .stat-card {
    padding: 20px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
  }
  
  .title {
    color: #8c8c8c;
    font-size: 14px;
    margin-bottom: 5px;
  }
  
  .value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
  }
  
  .change {
    font-size: 12px;
    color: #52c41a;
  }
  
  .charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .chart {
    padding: 20px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
  }
  
  .chart-content {
    height: 200px;
    background-color: #fafafa;
    margin-top: 10px;
  }
  
  .module-content {
    padding: 20px;
  }
  </style>
      